import 'package:flutter/cupertino.dart';
///在TabBarView外面封装一层,保证切换页面不会频繁调用接口刷新数据,类似于原生AutomaticKeepAliveClientMixin保持页面状态一样的效果
class KeepAliveWrapper extends StatefulWidget {
  final Widget child;

  const KeepAliveWrapper(this.child,{Key? key, }) : super(key: key);

  @override
  _KeepAliveWrapperState createState() => _KeepAliveWrapperState();
}

class _KeepAliveWrapperState extends State<KeepAliveWrapper>
    with AutomaticKeepAliveClientMixin {
  @override
  Widget build(BuildContext context) {
    return widget.child;
  }

  @override
  bool get wantKeepAlive => true;
}
